﻿using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class HouseDetail : System.Web.UI.Page
{
    private int _userId;
    public int UserId
    {
        get { return _userId; }
        set { _userId = value; }
    }

    private int _userType;
    public int UserType
    {
        get { return _userType; }
        set { _userType = value; }
    }

    private int _pId;
    public int PId
    {
        get { return _pId; }
        set { _pId = value; }
    }

    private House _hInfo;
    public House HInfo
    {
        get { return _hInfo; }
        set { _hInfo = value; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        Session["UserType"] = 0;
        Session["UserId"] = 2;
        Session["pId"] = 1004;
        if (Session["UserType"] == null || Session["UserId"] == null || Session["pId"] == null)
            Response.Redirect("~/Home.aspx");
        else
        {
            UserId = Int32.Parse(Session["UserId"].ToString());
            UserType = Int32.Parse(Session["UserType"].ToString());
            PId = Int32.Parse(Session["pId"].ToString());
        }
        Bind();
        
    }

    private void Bind()
    {
        int hId = -1;
        if (Request.QueryString["HouseId"] != null)
            hId = int.Parse(Request.QueryString["HouseId"].ToString());
        HInfo = HouseManage.GetHouseById(hId);
        if (HInfo == null)
            HInfo = new House();

        Page.DataBind();
    }

    protected void OrderBtnClick(object sender, EventArgs e)
    {

    }
}